Skip to content

fix(renderer): clip terminal contents to expected grid size (#4523)#5265

Merged
mitchellh merged 1 commit intoghostty-org:mainfrom
qwerasd205:clip-terminal-grid-in-renderer
Jan 21, 2025
Merged

fix(renderer): clip terminal contents to expected grid size (#4523)#5265
mitchellh merged 1 commit intoghostty-org:mainfrom
qwerasd205:clip-terminal-grid-in-renderer

Conversation

@qwerasd205
Copy link
Member

Resolves #4523

More notably this fixes a memory corruption crash that can occur while resizing the font under Metal while there's a lot of active changes occurring (e.g. while running DOOM fire). The change where all background colors are explicitly written exposed this issue, though it was technically a problem the whole time I'm fairly sure, just that the corruption it caused before was benign.

This significantly improves the robustness of the renderers since it prevents synchronization issues from causing memory corruption due to out of bounds read/writes while building the cells.

TODO: when viewport is narrower than renderer grid size, fill blank margin with bg color- currently appears as black, this only affects DECCOLM right now, and possibly could create single-frame artefacts during poorly managed resizes, but it's not ideal regardless.

…org#4523)

This significantly improves the robustness of the renderers since it
prevents synchronization issues from causing memory corruption due to
out of bounds read/writes while building the cells.

TODO: when viewport is narrower than renderer grid size, fill blank
margin with bg color- currently appears as black, this only affects
DECCOLM right now, and possibly could create single-frame artefacts
during poorly managed resizes, but it's not ideal regardless.
@mitchellh mitchellh merged commit 5cb2fa6 into ghostty-org:main Jan 21, 2025
30 checks passed
@mitchellh
Copy link
Contributor

Thanks! I didn't verify this but the logic looks good to me.

@github-actions github-actions bot added this to the 1.1.0 milestone Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renderers (Metal and OpenGL) should clip terminal if terminal grid size mismatches physical window

2 participants